<template>
  <div class="tenant-container">
    <!-- 背景装饰元素 -->
    <div class="background-decoration">
      <!-- 精美的动态背景 -->
      <div class="dynamic-background">
        <div class="building building-1"></div>
        <div class="building building-2"></div>
        <div class="building building-3"></div>
        <div class="building building-4"></div>
        <div class="building building-5"></div>
        <div class="cloud cloud-1"></div>
        <div class="cloud cloud-2"></div>
        <div class="cloud cloud-3"></div>
        <div class="sun"></div>
        <div class="light-ray ray-1"></div>
        <div class="light-ray ray-2"></div>
        <div class="light-ray ray-3"></div>
      </div>

      <!-- 浮动装饰元素 -->
      <div class="floating-shape shape-1"></div>
      <div class="floating-shape shape-2"></div>
      <div class="floating-shape shape-3"></div>
      <div class="floating-shape shape-4"></div>
      <div class="floating-shape shape-5"></div>
      <div class="floating-shape shape-6"></div>
    </div>

    <div class="tenant-wrapper">
      <!-- 顶部导航栏 -->
      <div class="top-navbar">
        <div class="navbar-left">
          <h1 class="app-title">租客中心</h1>
        </div>
        <div class="navbar-center">
          <el-menu
              :default-active="activeIndex"
              mode="horizontal"
              @select="handleSelect"
              background-color="rgba(255, 255, 255, 0.1)"
              text-color="#fff"
              active-text-color="#4A90E2"
          >
            <el-menu-item index="1" @click="goToHome">首页</el-menu-item>
            <el-menu-item index="2" @click="goToSearch">房源搜索</el-menu-item>
            <el-menu-item index="3" @click="goToPublish">发布房源</el-menu-item>
            <el-menu-item index="4" @click="goToMessages">消息中心</el-menu-item>
          </el-menu>
        </div>
        <div class="navbar-right">
          <el-dropdown @command="handleUserCommand">
            <span class="user-info">
              <el-avatar :size="32" src="https://cube.elemecdn.com/0/88/03b0d39583f48206768a7534e55bcpng.png" />
              <span class="username">张三</span>
            </span>
            <template #dropdown>
              <el-dropdown-menu>
                <el-dropdown-item command="profile">个人资料</el-dropdown-item>
                <el-dropdown-item command="settings">设置</el-dropdown-item>
                <el-dropdown-item command="logout" divided>退出登录</el-dropdown-item>
              </el-dropdown-menu>
            </template>
          </el-dropdown>
        </div>
      </div>

      <div class="main-content">
        <!-- 侧边栏 -->
        <div class="sidebar">
          <el-menu
              :default-active="activeMenu"
              class="el-menu-vertical"
              background-color="rgba(0, 0, 0, 0.2)"
              text-color="#fff"
              active-text-color="#4A90E2"
          >
            <el-menu-item index="dashboard" @click="goToHome">
              <el-icon><House /></el-icon>
              <span>首页</span>
            </el-menu-item>
            <el-menu-item index="search" @click="goToSearch">
              <el-icon><Search /></el-icon>
              <span>房源搜索</span>
            </el-menu-item>
            <el-sub-menu index="publish">
              <template #title>
                <el-icon><OfficeBuilding /></el-icon>
                <span>发布房源</span>
              </template>
              <el-menu-item index="publish-house" @click="goToPublishNew">发布新房源</el-menu-item>
              <el-menu-item index="my-houses" @click="goToMyHouses">我的房源</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="agent">
              <template #title>
                <el-icon><User /></el-icon>
                <span>中介申请</span>
              </template>
              <el-menu-item index="agent-apply" @click="goToAgentApply">申请中介</el-menu-item>
              <el-menu-item index="agent-status" @click="goToAgentStatus">申请状态</el-menu-item>
              <el-menu-item index="agent-houses" @click="goToAgentHouses">可代理房源</el-menu-item>
            </el-sub-menu>
            <el-sub-menu index="rental">
              <template #title>
                <el-icon><Key /></el-icon>
                <span>租房管理</span>
              </template>
              <el-menu-item index="tenant" @click="goToTenant">我是租客</el-menu-item>
              <el-menu-item index="landlord" @click="goToLandlord">我是房东</el-menu-item>
              <el-menu-item index="agent-rental" @click="goToAgentRental">中介租房</el-menu-item>
            </el-sub-menu>
            <el-menu-item index="messages" @click="goToMessages">
              <el-icon><ChatLineSquare /></el-icon>
              <span>消息中心</span>
            </el-menu-item>
            <el-menu-item index="profile" @click="goToProfile">
              <el-icon><Setting /></el-icon>
              <span>个人资料</span>
            </el-menu-item>
          </el-menu>
        </div>

        <!-- 租客内容区 -->
        <div class="content-area">
          <div class="tenant-header">
            <h2>租客中心</h2>
            <p>管理您的租房信息和相关服务</p>
          </div>

          <!-- 统计卡片 -->
          <div class="tenant-stats">
            <el-row :gutter="20">
              <el-col :span="6">
                <div class="stat-card">
                  <div class="stat-icon bg-blue">
                    <House />
                  </div>
                  <div class="stat-content">
                    <div class="stat-value">{{ rentalCount }}</div>
                    <div class="stat-title">租房数量</div>
                  </div>
                </div>
              </el-col>
              <el-col :span="6">
                <div class="stat-card" @click="goToMaintenanceResults">
                  <div class="stat-icon bg-green">
                    <ChatLineSquare />
                  </div>
                  <div class="stat-content">
                    <div class="stat-value">{{ maintenanceResultsCount }}</div>
                    <div class="stat-title">申请维修结果</div>
                  </div>
                </div>
              </el-col>
              <el-col :span="6">
                <div class="stat-card" @click="goToContractManagement">
                  <div class="stat-icon bg-orange">
                    <Document />
                  </div>
                  <div class="stat-content">
                    <div class="stat-value">{{ contractCount }}</div>
                    <div class="stat-title">发起的签约</div>
                  </div>
                </div>
              </el-col>
              <el-col :span="6">
                <div class="stat-card" @click="goToCheckoutResults">
                  <div class="stat-icon bg-red">
                    <Bell />
                  </div>
                  <div class="stat-content">
                    <div class="stat-value">{{ checkoutResultsCount }}</div>
                    <div class="stat-title">退租结果</div>
                  </div>
                </div>
              </el-col>
            </el-row>
          </div>

          <!-- 租房信息 -->
          <div class="rental-section">
            <el-tabs v-model="activeTab" @tab-change="handleTabChange">
              <el-tab-pane label="正在进行" name="active">
                <div class="rental-list">
                  <el-row :gutter="20">
                    <el-col
                      :span="12"
                      v-for="rental in activeRentals"
                      :key="rental.id"
                      class="rental-col"
                    >
                      <div class="rental-card">
                        <div class="rental-header">
                          <h3>{{ rental.houseTitle }}</h3>
                          <el-tag :type="getRentalStatusType(rental.status)">
                            {{ getRentalStatusText(rental.status) }}
                          </el-tag>
                        </div>

                        <div class="rental-content">
                          <div class="rental-info">
                            <p><el-icon><Location /></el-icon> {{ rental.houseAddress }}</p>
                            <p><el-icon><Calendar /></el-icon> 租期: {{ rental.startDate }} 至 {{ rental.endDate }}</p>
                            <p><el-icon><Money /></el-icon> 租金: ¥{{ rental.rent }}/月</p>
                            <p><el-icon><User /></el-icon> 房东: {{ rental.landlordName }}</p>
                          </div>
                          <div class="rental-image">
                            <img :src="rental.houseImage" :alt="rental.houseTitle">
                          </div>
                        </div>
                        <div class="rental-actions">
                          <el-button size="small" @click="viewContract(rental)">查看合同</el-button>
                          <el-button size="small" type="primary" @click="applyMaintenance(rental)">申请维修</el-button>
                          <el-button size="small" @click="contactLandlord(rental)">联系房东</el-button>
                          <el-button size="small" type="danger" @click="applyCheckout(rental)">退租</el-button>
                        </div>
                      </div>
                    </el-col>
                  </el-row>
                </div>
              </el-tab-pane>
              <el-tab-pane label="历史记录" name="history">
                <div class="rental-list">
                  <el-row :gutter="20">
                    <el-col
                      :span="12"
                      v-for="rental in historyRentals"
                      :key="rental.id"
                      class="rental-col"
                    >
                      <div class="rental-card" @click="viewHistoryDetail(rental)">
                        <div class="rental-header">
                          <h3>{{ rental.houseTitle }}</h3>
                          <el-tag :type="getRentalStatusType(rental.status)">
                            {{ getRentalStatusText(rental.status) }}
                          </el-tag>
                        </div>

                        <div class="rental-content">
                          <div class="rental-info">
                            <p><el-icon><Location /></el-icon> {{ rental.houseAddress }}</p>
                            <p><el-icon><Calendar /></el-icon> 租期: {{ rental.startDate }} 至 {{ rental.endDate }}</p>
                            <p><el-icon><Money /></el-icon> 租金: ¥{{ rental.rent }}/月</p>
                            <p><el-icon><User /></el-icon> 房东: {{ rental.landlordName }}</p>
                          </div>
                          <div class="rental-image">
                            <img :src="rental.houseImage" :alt="rental.houseTitle">
                          </div>
                        </div>
                      </div>
                    </el-col>
                  </el-row>
                </div>
              </el-tab-pane>
              <el-tab-pane label="收藏房源" name="favorites">
                <div class="houses-container">
                  <el-row :gutter="20">
                    <el-col
                        :span="8"
                        v-for="house in favoriteHouses"
                        :key="house.id"
                        class="house-col"
                    >
                      <div class="house-card" @click="viewHouseDetail(house.id)">
                        <div class="house-image">
                          <img :src="house.image" :alt="house.title" />
                          <div class="house-price">¥{{ house.price }}/月</div>
                          <div
                              class="favorite-button"
                              :class="{ favorited: house.favorited }"
                              @click.stop="toggleFavorite(house)"
                          >
                            <el-icon>
                              <Star v-if="house.favorited" />
                              <StarFilled v-else />
                            </el-icon>
                          </div>
                        </div>
                        <div class="house-info">
                          <h3 class="house-title">{{ house.title }}</h3>
                          <p class="house-address">
                            <el-icon><Location /></el-icon>
                            {{ house.address }}
                          </p>
                          <div class="house-meta">
                            <span>{{ house.layout }}</span>
                            <span>{{ house.area }}㎡</span>
                            <span>{{ house.orientation }}</span>
                          </div>
                          <div class="house-tags">
                            <el-tag
                                v-for="tag in house.tags"
                                :key="tag"
                                size="small"
                                :type="getTagType(tag)"
                            >
                              {{ tag }}
                            </el-tag>
                          </div>
                          <div class="house-actions">
                            <el-button
                                size="small"
                                type="primary"
                                @click.stop="contactLandlord(house)"
                            >
                              联系房东
                            </el-button>
                            <el-button
                                size="small"
                                @click.stop="scheduleVisit(house)"
                            >
                              预约看房
                            </el-button>
                          </div>
                        </div>
                      </div>
                    </el-col>
                  </el-row>
                </div>
              </el-tab-pane>
            </el-tabs>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'
import { ElMessage, ElMessageBox } from 'element-plus'

const router = useRouter()
const activeMenu = ref('tenant')
const activeIndex = ref('1')
const activeTab = ref('active')

// 统计数据
const rentalCount = ref(2)
const unreadMessages = ref(3)
const contractCount = ref(1)
const notificationCount = ref(2)

// 正在进行的租房信息
const activeRentals = ref([
  {
    id: 1,
    houseTitle: '精致一居室公寓',
    houseAddress: '北京市朝阳区CBD建国路123号',
    startDate: '2023-01-01',
    endDate: '2023-12-31',
    rent: 4500,
    landlordName: '李四',
    houseImage: 'https://images.unsplash.com/photo-1560448204-e02f11c3d0e2?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1769&q=80',
    status: 'active'
  },
  {
    id: 2,
    houseTitle: '豪华两居室',
    houseAddress: '北京市朝阳区三里屯太古里456号',
    startDate: '2023-03-01',
    endDate: '2024-02-29',
    rent: 8500,
    landlordName: '王五',
    houseImage: 'https://images.unsplash.com/photo-1600585154340-be6161a56a0c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80',
    status: 'active'
  }
])

// 历史租房信息
const historyRentals = ref([
  {
    id: 3,
    houseTitle: '舒适三居室',
    houseAddress: '北京市朝阳区国贸SOHO789号',
    startDate: '2022-01-01',
    endDate: '2022-12-31',
    rent: 12000,
    landlordName: '赵六',
    houseImage: 'https://images.unsplash.com/photo-1600596542815-ffad4c1539a9?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80',
    status: 'completed'
  }
])

// 收藏房源
const favoriteHouses = ref([
  {
    id: 4,
    title: '温馨单间出租',
    address: '北京市朝阳区双井地铁站101号',
    price: 2800,
    area: 35,
    layout: '单间',
    orientation: '南',
    image: 'https://images.unsplash.com/photo-1584622650111-993a426fbf0a?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1770&q=80',
    tags: ['近地铁', '精装修'],
    favorited: true
  },
  {
    id: 5,
    title: '精品复式公寓',
    address: '北京市朝阳区大望路202号',
    price: 7200,
    area: 85,
    layout: '2室1厅',
    orientation: '南北',
    image: 'https://images.unsplash.com/photo-1600607687939-ce8a6c25118c?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D&auto=format&fit=crop&w=1753&q=80',
    tags: ['复式', '拎包入住'],
    favorited: true
  }
])

// 获取租房状态类型
const getRentalStatusType = (status) => {
  const statusTypes = {
    'active': 'success',
    'completed': 'info'
  }
  return statusTypes[status] || 'info'
}

// 获取租房状态文本
const getRentalStatusText = (status) => {
  const statusTexts = {
    'active': '租赁中',
    'completed': '已完成'
  }
  return statusTexts[status] || '未知状态'
}

// 获取标签类型
const getTagType = (tag) => {
  const tagTypes = {
    '近地铁': 'success',
    '精装修': 'warning',
    '拎包入住': 'info',
    '新上架': 'danger',
    '学区房': 'primary',
    '地铁房': 'success',
    '别墅': 'primary',
    '带花园': 'success',
    '独栋': 'warning'
  }
  return tagTypes[tag] || 'info'
}

// 顶部导航栏跳转
const goToHome = () => {
  router.push('/')
}

const goToSearch = () => {
  router.push('/house/search')
}

const goToPublish = () => {
  router.push('/house/publish')
}

const goToMessages = () => {
  router.push('/message')
}

// 用户命令处理
const handleUserCommand = (command) => {
  switch (command) {
    case 'profile':
      router.push('/profile')
      break
    case 'settings':
      router.push('/settings')
      break
    case 'logout':
      ElMessage.success('退出登录成功')
      localStorage.removeItem('userEmail')
      localStorage.removeItem('isLoggedIn')
      router.push('/login')
      break
  }
}

// 侧边栏跳转
const goToPublishNew = () => {
  router.push('/house/publish')
}

const goToMyHouses = () => {
  router.push('/house/my-houses')
}

const goToAgentApply = () => {
  router.push('/agent/apply')
}

const goToAgentStatus = () => {
  router.push('/agent/status')
}

const goToAgentHouses = () => {
  router.push('/agent/houses')
}

const goToTenant = () => {
  router.push('/rental/tenant')
}

const goToLandlord = () => {
  router.push('/rental/landlord')
}

const goToAgentRental = () => {
  router.push('/rental/agent')
}

const goToProfile = () => {
  router.push('/profile')
}

// 菜单选择处理
const handleSelect = (key) => {
  switch (key) {
    case '1':
      router.push('/')
      break
    case '2':
      router.push('/house/search')
      break
    case '3':
      router.push('/house/publish')
      break
    case '4':
      router.push('/message')
      break
  }
}

// 查看合同管理
const goToContractManagement = () => {
  router.push('/contract/tenant')
}

// 处理标签切换
const handleTabChange = (tab) => {
  ElMessage.info(`切换到${tab === 'active' ? '正在进行' : tab === 'history' ? '历史记录' : '收藏房源'}标签`)
}

// 查看合同
const viewContract = (rental) => {
  ElMessage.info(`查看"${rental.houseTitle}"的合同`)
}

// 缴纳租金
const payRent = (rental) => {
  ElMessage.info(`缴纳"${rental.houseTitle}"的租金`)
}

// 联系房东
const contactLandlord = (rental) => {
  ElMessage.info(`联系"${rental.houseTitle}"的房东`)
}

// 查看历史详情
const viewHistoryDetail = (rental) => {
  ElMessage.info(`查看"${rental.houseTitle}"的历史详情`)
}

// 查看房源详情
const viewHouseDetail = (id) => {
  router.push(`/house/detail/${id}`)
}

// 切换收藏状态
const toggleFavorite = (house) => {
  house.favorited = !house.favorited
  ElMessage.success(house.favorited ? '已收藏' : '已取消收藏')
}

// 联系房东
const contactLandlordFavorite = (house) => {
  ElMessage.info(`联系"${house.title}"的房东`)
}

// 预约看房
const scheduleVisit = (house) => {
  ElMessage.info(`预约看"${house.title}"房`)
}

// 申请维修方法
const applyMaintenance = (rental) => {
  router.push({ name: 'TenantMaintenance', query: { rentalId: rental.id, houseTitle: rental.houseTitle, houseAddress: rental.houseAddress } })
}

// 退租申请方法
const applyCheckout = (rental) => {
  ElMessageBox.confirm('确认要提交退租申请吗？', '提示', {
    confirmButtonText: '确定',
    cancelButtonText: '取消',
    type: 'warning',
  }).then(() => {
    router.push({ name: 'CheckoutApply', query: { rentalId: rental.id, houseTitle: rental.houseTitle } })
    ElMessage.success('已跳转至退租申请页面')
  }).catch(() => {
    ElMessage.info('已取消退租申请')
  })
}

const goToMaintenance = (rentalId) => {
  router.push({ name: 'TenantMaintenance', query: { rentalId } })
}

const goToMaintenanceResults = () => {
  router.push({ name: 'MaintenanceResults' })
}

const goToCheckoutResults = () => {
  router.push({ name: 'CheckoutResults' })
}

const showCheckoutDialog = (rentalId) => {
  ElMessageBox.confirm(
    '提前退租将担负罚金，押金将根据合同条款处理，确定要退租吗？',
    '退租提醒',
    {
      confirmButtonText: '确定',
      cancelButtonText: '取消',
      type: 'warning',
    }
  ).then(() => {
    router.push({ name: 'CheckoutApply', query: { rentalId } })
    ElMessage.success('请填写退租理由')
  }).catch(() => {
    ElMessage.info('已取消退租')
  })
}
</script>

<style scoped>
.tenant-container {
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}

.background-decoration {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

/* 精美的动态背景 */
.dynamic-background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, #1a2980, #26d0ce);
  overflow: hidden;
}

/* 建筑物 */
.building {
  position: absolute;
  bottom: 0;
  background: rgba(30, 30, 50, 0.8);
  border-radius: 5px 5px 0 0;
  box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
}

.building-1 {
  left: 10%;
  width: 80px;
  height: 300px;
  animation: buildingGlow 4s infinite alternate;
}

.building-2 {
  left: 25%;
  width: 120px;
  height: 400px;
  animation: buildingGlow 5s infinite alternate-reverse;
}

.building-3 {
  left: 45%;
  width: 100px;
  height: 350px;
  animation: buildingGlow 6s infinite alternate;
}

.building-4 {
  left: 65%;
  width: 140px;
  height: 450px;
  animation: buildingGlow 4.5s infinite alternate-reverse;
}

.building-5 {
  left: 80%;
  width: 90px;
  height: 320px;
  animation: buildingGlow 5.5s infinite alternate;
}

@keyframes buildingGlow {
  0% {
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
  }
  100% {
    box-shadow: 0 -5px 25px rgba(100, 200, 255, 0.6);
  }
}

/* 云朵 */
.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  filter: blur(2px);
}

.cloud-1 {
  top: 20%;
  left: 5%;
  width: 80px;
  height: 30px;
  animation: cloudMove 25s linear infinite;
}

.cloud-2 {
  top: 35%;
  left: 70%;
  width: 120px;
  height: 40px;
  animation: cloudMove 30s linear infinite;
}

.cloud-3 {
  top: 15%;
  left: 40%;
  width: 100px;
  height: 35px;
  animation: cloudMove 35s linear infinite;
}

@keyframes cloudMove {
  0% {
    transform: translateX(-100px);
  }
  100% {
    transform: translateX(calc(100vw + 100px));
  }
}

/* 太阳 */
.sun {
  position: absolute;
  top: 80px;
  right: 100px;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, #ffeb3b, #ffc107);
  border-radius: 50%;
  box-shadow: 0 0 40px #ff9800, 0 0 80px #ff5722;
  animation: sunPulse 3s infinite alternate;
}

@keyframes sunPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 40px #ff9800, 0 0 80px #ff5722;
  }
  100% {
    transform: scale(1.1);
    box-shadow: 0 0 60px #ff9800, 0 0 100px #ff5722;
  }
}

/* 光线 */
.light-ray {
  position: absolute;
  top: 120px;
  right: 140px;
  width: 400px;
  height: 200px;
  background: linear-gradient(to right, transparent, rgba(255, 235, 59, 0.2), transparent);
  transform-origin: left center;
  animation: rayRotate 10s infinite linear;
}

.ray-1 {
  transform: rotate(0deg);
  animation-delay: 0s;
}

.ray-2 {
  transform: rotate(60deg);
  animation-delay: 2s;
}

.ray-3 {
  transform: rotate(120deg);
  animation-delay: 4s;
}

@keyframes rayRotate {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* 浮动装饰元素 */
.floating-shape {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  animation: float 15s infinite linear;
}

.shape-1 {
  width: 300px;
  height: 300px;
  top: -100px;
  left: -100px;
  animation-duration: 20s;
  background: radial-gradient(circle, rgba(74, 144, 226, 0.2) 0%, transparent 70%);
}

.shape-2 {
  width: 200px;
  height: 200px;
  bottom: -80px;
  right: -80px;
  animation-duration: 25s;
  animation-direction: reverse;
  background: radial-gradient(circle, rgba(255, 107, 107, 0.2) 0%, transparent 70%);
}

.shape-3 {
  width: 150px;
  height: 150px;
  top: 30%;
  right: 20%;
  animation-duration: 15s;
  background: radial-gradient(circle, rgba(80, 227, 194, 0.2) 0%, transparent 70%);
}

.shape-4 {
  width: 100px;
  height: 100px;
  bottom: 20%;
  left: 20%;
  animation-duration: 18s;
  animation-direction: reverse;
  background: radial-gradient(circle, rgba(255, 209, 102, 0.2) 0%, transparent 70%);
}

.shape-5 {
  width: 250px;
  height: 250px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-duration: 22s;
  background: radial-gradient(circle, rgba(155, 89, 182, 0.2) 0%, transparent 70%);
}

.shape-6 {
  width: 180px;
  height: 180px;
  top: 70%;
  left: 10%;
  animation-duration: 28s;
  background: radial-gradient(circle, rgba(231, 76, 60, 0.2) 0%, transparent 70%);
}

@keyframes float {
  0% {
    transform: translate(0, 0) rotate(0deg);
  }
  25% {
    transform: translate(20px, 20px) rotate(90deg);
  }
  50% {
    transform: translate(0, 40px) rotate(180deg);
  }
  75% {
    transform: translate(-20px, 20px) rotate(270deg);
  }
  100% {
    transform: translate(0, 0) rotate(360deg);
  }
}

.tenant-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  z-index: 1;
  position: relative;
}

.top-navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 30px;
  background: rgba(0, 0, 0, 0.2);
  backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-title {
  color: white;
  font-size: 24px;
  font-weight: 700;
  margin: 0;
}

.navbar-center {
  flex: 1;
  margin: 0 20px;
}

:deep(.el-menu--horizontal) {
  border: none;
  background: transparent !important;
}

:deep(.el-menu--horizontal .el-menu-item) {
  color: white;
  border: none;
}

:deep(.el-menu--horizontal .el-menu-item:hover) {
  background: rgba(255, 255, 255, 0.2) !important;
}

:deep(.el-menu--horizontal .el-menu-item.is-active) {
  color: #4A90E2 !important;
  border: none;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: white;
}

.username {
  font-size: 16px;
  font-weight: 500;
}

.main-content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  width: 250px;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  padding: 20px 0;
  height: 100%;
  box-shadow: 3px 0 10px rgba(0, 0, 0, 0.2);
}

.el-menu-vertical {
  border: none !important;
  height: 100%;
}

.el-menu-item,
.el-sub-menu__title {
  margin: 5px 10px;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.el-menu-item:hover,
.el-sub-menu__title:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
}

.content-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  overflow-y: auto;
  padding: 20px;
}

.tenant-header {
  margin-bottom: 30px;
}

.tenant-header h2 {
  color: #2c3e50;
  font-size: 28px;
  margin: 0 0 10px;
}

.tenant-header p {
  color: #7f8c8d;
  margin: 0;
}

.tenant-stats {
  margin-bottom: 30px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  height: 100px;
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 15px;
  color: white;
  font-size: 24px;
}

.bg-blue {
  background: linear-gradient(135deg, #4A90E2 0%, #64b5f6 100%);
}

.bg-green {
  background: linear-gradient(135deg, #50E3C2 0%, #80deea 100%);
}

.bg-orange {
  background: linear-gradient(135deg, #FFA500 0%, #ffb74d 100%);
}

.bg-red {
  background: linear-gradient(135deg, #FF6B6B 0%, #ff8a80 100%);
}

.bg-purple {
  background: linear-gradient(135deg, #9B59B6 0%, #ba68c8 100%);
}

.stat-content {
  flex: 1;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #2c3e50;
  margin-bottom: 5px;
}

.stat-title {
  font-size: 14px;
  color: #7f8c8d;
}

.rental-section {
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.rental-list {
  padding: 20px;
  flex: 1;
  overflow-y: auto;
}

.rental-col {
  margin-bottom: 20px;
}

.rental-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.3s ease;
  height: 100%;
}

.rental-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.rental-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
}

.rental-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #2c3e50;
}

.rental-content {
  display: flex;
  padding: 20px;
}

.rental-info {
  flex: 1;
  min-width: 0;
}

.rental-info p {
  margin: 0 0 10px;
  font-size: 14px;
  color: #7f8c8d;
  display: flex;
  align-items: center;
  gap: 8px;
}

.rental-image {
  width: 120px;
  height: 100px;
  border-radius: 8px;
  overflow: hidden;
  margin-left: 20px;
  flex-shrink: 0;
}

.rental-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rental-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 20px 20px;
}

.houses-container {
  padding: 20px;
}

.house-col {
  margin-bottom: 20px;
}

.house-card {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: all 0.3s ease;
  height: 100%;
}

.house-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.house-image {
  position: relative;
  height: 200px;
}

.house-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.house-card:hover .house-image img {
  transform: scale(1.05);
}

.house-price {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(74, 144, 226, 0.9);
  color: white;
  padding: 5px 10px;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
}

.favorite-button {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #7f8c8d;
  transition: all 0.3s ease;
}

.favorite-button:hover,
.favorite-button.favorited {
  color: #FF6B6B;
}

.house-info {
  padding: 15px;
}

.house-title {
  margin: 0 0 10px;
  font-size: 18px;
  font-weight: 700;
  color: #2c3e50;
}

.house-address {
  margin: 0 0 10px;
  font-size: 14px;
  color: #7f8c8d;
  display: flex;
  align-items: center;
  gap: 5px;
}

.house-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
  color: #7f8c8d;
}

.house-tags {
  display: flex;
  gap: 5px;
  margin-bottom: 15px;
}

.house-actions {
  display: flex;
  gap: 10px;
}

@media (max-width: 992px) {
  .sidebar {
    width: 80px;
  }

  .app-title,
  .el-menu-item span,
  .el-sub-menu__title span {
    display: none;
  }

  .tenant-header {
    text-align: center;
  }

  .tenant-stats .el-row {
    flex-direction: column;
    gap: 15px;
  }

  .tenant-stats .el-col {
    width: 100%;
  }

  .rental-content {
    flex-direction: column;
  }

  .rental-image {
    width: 100%;
    height: 150px;
    margin: 15px 0 0;
  }

  .rental-actions {
    flex-direction: column;
  }

  .rental-actions .el-button {
    width: 100%;
  }
}
</style>
